home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / mappers.cc < prev    next >
C/C++ Source or Header  |  1997-06-25  |  7KB  |  287 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. /* Modified by Klaus Gebhardt, 1997 */
  24.  
  25. #ifdef HAVE_CONFIG_H
  26. #include <config.h>
  27. #endif
  28.  
  29. #include <cctype>
  30. #include <cfloat>
  31.  
  32. #include "defun.h"
  33. #include "error.h"
  34. #include "mappers.h"
  35.  
  36. // XXX FIXME XXX -- perhaps this could be avoided by determining
  37. // whether the is* functions are actually functions or just macros.
  38.  
  39. int
  40. xisalnum (int c)
  41. {
  42.   return isalnum (c);
  43. }
  44.  
  45. int
  46. xisalpha (int c)
  47. {
  48.   return isalpha (c);
  49. }
  50.  
  51. int
  52. xisascii (int c)
  53. {
  54.   return isascii (c);
  55. }
  56.  
  57. int
  58. xiscntrl (int c)
  59. {
  60.   return iscntrl (c);
  61. }
  62.  
  63. int
  64. xisdigit (int c)
  65. {
  66.   return isdigit (c);
  67. }
  68.  
  69. int
  70. xisgraph (int c)
  71. {
  72.   return isgraph (c);
  73. }
  74.  
  75. int
  76. xislower (int c)
  77. {
  78.   return islower (c);
  79. }
  80.  
  81. int
  82. xisprint (int c)
  83. {
  84.   return isprint (c);
  85. }
  86.  
  87. int
  88. xispunct (int c)
  89. {
  90.   return ispunct (c);
  91. }
  92.  
  93. int
  94. xisspace (int c)
  95. {
  96.   return isspace (c);
  97. }
  98.  
  99. int
  100. xisupper (int c)
  101. {
  102.   return isupper (c);
  103. }
  104.  
  105. int
  106. xisxdigit (int c)
  107. {
  108.   return isxdigit (c);
  109. }
  110.  
  111. int
  112. xtoascii (int c)
  113. {
  114.   return toascii (c);
  115. }
  116.  
  117. int
  118. xtolower (int c)
  119. {
  120.   return tolower (c);
  121. }
  122.  
  123. int
  124. xtoupper (int c)
  125. {
  126.   return toupper (c);
  127. }
  128.  
  129. void
  130. install_mapper_functions (void)
  131. {
  132.   DEFUN_MAPPER (abs, 0, fabs, abs, 0, 0.0, 0.0, 0,
  133.     "abs (X): compute abs (X) for each element of X");
  134.  
  135.   DEFUN_MAPPER (acos, 0, acos, 0, acos, -1.0, 1.0, 1,
  136.     "acos (X): compute acos (X) for each element of X");
  137.  
  138.   DEFUN_MAPPER (acosh, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1,
  139.     "acosh (X): compute acosh (X) for each element of X");
  140.  
  141.   DEFUN_MAPPER (angle, 0, arg, arg, 0, 0.0, 0.0, 0,
  142.     "angle (X): compute arg (X) for each element of X");
  143.  
  144.   DEFUN_MAPPER (arg, 0, arg, arg, 0, 0.0, 0.0, 0,
  145.     "arg (X): compute arg (X) for each element of X");
  146.  
  147.   DEFUN_MAPPER (asin, 0, asin, 0, asin, -1.0, 1.0, 1,
  148.     "asin (X): compute asin (X) for each element of X");
  149.  
  150.   DEFUN_MAPPER (asinh, 0, asinh, 0, asinh, 0.0, 0.0, 0,
  151.     "asinh (X): compute asinh (X) for each element of X");
  152.  
  153.   DEFUN_MAPPER (atan, 0, atan, 0, atan, 0.0, 0.0, 0,
  154.     "atan (X): compute atan (X) for each element of X");
  155.  
  156.   DEFUN_MAPPER (atanh, 0, atanh, 0, atanh, -1.0, 1.0, 1,
  157.     "atanh (X): compute atanh (X) for each element of X");
  158.  
  159.   DEFUN_MAPPER (ceil, 0, ceil, 0, ceil, 0.0, 0.0, 0,
  160.     "ceil (X): round elements of X toward +Inf");
  161.  
  162.   DEFUN_MAPPER (conj, 0, conj, 0, conj, 0.0, 0.0, 0,
  163.     "conj (X): compute complex conjugate for each element of X");
  164.  
  165.   DEFUN_MAPPER (cos, 0, cos, 0, cos, 0.0, 0.0, 0,
  166.     "cos (X): compute cos (X) for each element of X");
  167.  
  168.   DEFUN_MAPPER (cosh, 0, cosh, 0, cosh, 0.0, 0.0, 0,
  169.     "cosh (X): compute cosh (X) for each element of X");
  170.  
  171.   DEFUN_MAPPER (erf, 0, xerf, 0, 0, 0.0, 0.0, 0,
  172.     "erf (X): compute erf (X) for each element of X");
  173.  
  174.   DEFUN_MAPPER (erfc, 0, xerfc, 0, 0, 0.0, 0.0, 0,
  175.     "erfc (X): compute erfc (X) for each element of X");
  176.  
  177.   DEFUN_MAPPER (exp, 0, exp, 0, exp, 0.0, 0.0, 0,
  178.     "exp (X): compute exp (X) for each element of X");
  179.  
  180.   DEFUN_MAPPER (finite, 0, xfinite, xfinite, 0, 0.0, 0.0, 0,
  181.     "finite (X): return 1 for finite elements of X");
  182.  
  183.   DEFUN_MAPPER (fix, 0, fix, 0, fix, 0.0, 0.0, 0,
  184.     "fix (X): round elements of X toward zero");
  185.  
  186.   DEFUN_MAPPER (floor, 0, floor, 0, floor, 0.0, 0.0, 0,
  187.     "floor (X): round elements of X toward -Inf");
  188.  
  189.   DEFUN_MAPPER (gamma, 0, xgamma, 0, 0, 0.0, 0.0, 0,
  190.     "gamma (X): compute gamma (X) for each element of X");
  191.  
  192.   DEFUN_MAPPER (imag, 0, imag, imag, 0, 0.0, 0.0, 0,
  193.     "imag (X): return imaginary part for each elements of X");
  194.  
  195.   DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0.0, 0.0, 0,
  196.     "isalnum (X): ");
  197.  
  198.   DEFUN_MAPPER (isalpha, xisalpha, 0, 0, 0, 0.0, 0.0, 0,
  199.     "isalpha (X): ");
  200.  
  201.   DEFUN_MAPPER (isascii, xisascii, 0, 0, 0, 0.0, 0.0, 0,
  202.     "isascii (X): ");
  203.  
  204.   DEFUN_MAPPER (iscntrl, xiscntrl, 0, 0, 0, 0.0, 0.0, 0,
  205.     "iscntrl (X): ");
  206.  
  207.   DEFUN_MAPPER (isdigit, xisdigit, 0, 0, 0, 0.0, 0.0, 0,
  208.     "isdigit (X): ");
  209.  
  210.   DEFUN_MAPPER (isinf, 0, xisinf, xisinf, 0, 0.0, 0.0, 0,
  211.     "isinf (X): return 1 for elements of X infinite");
  212.  
  213.   DEFUN_MAPPER (isgraph, xisgraph, 0, 0, 0, 0.0, 0.0, 0,
  214.     "isgraph (X): ");
  215.  
  216.   DEFUN_MAPPER (islower, xislower, 0, 0, 0, 0.0, 0.0, 0,
  217.     "islower (X): ");
  218.  
  219.   DEFUN_MAPPER (isnan, 0, xisnan, xisnan, 0, 0.0, 0.0, 0,
  220.     "isnan (X): return 1 where elements of X are NaNs");
  221.  
  222.   DEFUN_MAPPER (isprint, xisprint, 0, 0, 0, 0.0, 0.0, 0,
  223.     "isprint (X): ");
  224.  
  225.   DEFUN_MAPPER (ispunct, xispunct, 0, 0, 0, 0.0, 0.0, 0,
  226.     "ispunct (X): ");
  227.  
  228.   DEFUN_MAPPER (isspace, xisspace, 0, 0, 0, 0.0, 0.0, 0,
  229.     "isspace (X): ");
  230.  
  231.   DEFUN_MAPPER (isupper, xisupper, 0, 0, 0, 0.0, 0.0, 0,
  232.     "isupper (X): ");
  233.  
  234.   DEFUN_MAPPER (isxdigit, xisxdigit, 0, 0, 0, 0.0, 0.0, 0,
  235.     "isxdigit (X): ");
  236.  
  237.   DEFUN_MAPPER (lgamma, 0, xlgamma, 0, 0, 0.0, 0.0, 0,
  238.     "lgamma (X): compute log gamma (X) for each element of X");
  239.  
  240.   DEFUN_MAPPER (log, 0, log, 0, log, 0.0, DBL_MAX, 1,
  241.     "log (X): compute log (X) for each element of X");
  242.  
  243.   DEFUN_MAPPER (log10, 0, log10, 0, log10, 0.0, DBL_MAX, 1,
  244.     "log10 (X): compute log10 (X) for each element of X");
  245.  
  246.   DEFUN_MAPPER (real, 0, real, real, 0, 0.0, 0.0, 0,
  247.     "real (X): return real part for each element of X");
  248.  
  249.   DEFUN_MAPPER (round, 0, round, 0, round, 0.0, 0.0, 0,
  250.     "round (X): round elements of X to nearest integer");
  251.  
  252.   DEFUN_MAPPER (sign, 0, signum, 0, signum, 0.0, 0.0, 0,
  253.     "sign (X): apply signum function to elements of X");
  254.  
  255.   DEFUN_MAPPER (sin, 0, sin, 0, sin, 0.0, 0.0, 0,
  256.     "sin (X): compute sin (X) for each element of X");
  257.  
  258.   DEFUN_MAPPER (sinh, 0, sinh, 0, sinh, 0.0, 0.0, 0,
  259.     "sinh (X): compute sinh (X) for each element of X");
  260.  
  261.   DEFUN_MAPPER (sqrt, 0, sqrt, 0, sqrt, 0.0, DBL_MAX, 1,
  262.     "sqrt (X): compute sqrt (X) for each element of X");
  263.  
  264.   DEFUN_MAPPER (tan, 0, tan, 0, tan, 0.0, 0.0, 0,
  265.     "tan (X): compute tan (X) for each element of X");
  266.  
  267.   DEFUN_MAPPER (tanh, 0, tanh, 0, tanh, 0.0, 0.0, 0,
  268.     "tanh (X): compute tanh (X) for each element of X");
  269.  
  270.   DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0.0, 0.0, 1,
  271.     "toascii (STRING): return ASCII representation of STRING in a matrix");
  272.  
  273.   DEFUN_MAPPER (tolower, xtolower, 0, 0, 0, 0.0, 0.0, 2,
  274.     "tolower (STRING): convert upper case characters to lower case in STRING");
  275.  
  276.   DEFUN_MAPPER (toupper, xtoupper, 0, 0, 0, 0.0, 0.0, 2,
  277.     "toupper (STRING): convert lower case characters to upper case in STRING");
  278.  
  279.   DEFALIAS (gammaln, lgamma);
  280. }
  281.  
  282. /*
  283. ;;; Local Variables: ***
  284. ;;; mode: C++ ***
  285. ;;; End: ***
  286. */
  287.